/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package EL;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Embeddable;

/**
 *
 * @author Tian
 */
@Embeddable
public class ReservationDetailsPK implements Serializable {
    @Basic(optional = false)
    @Column(name = "reservationID")
    private String reservationID;
    @Basic(optional = false)
    @Column(name = "tableID")
    private int tableID;

    public ReservationDetailsPK()
    {
    }

    public ReservationDetailsPK(String reservationID, int tableID)
    {
        this.reservationID = reservationID;
        this.tableID = tableID;
    }

    public String getReservationID()
    {
        return reservationID;
    }

    public void setReservationID(String reservationID)
    {
        this.reservationID = reservationID;
    }

    public int getTableID()
    {
        return tableID;
    }

    public void setTableID(int tableID)
    {
        this.tableID = tableID;
    }

    @Override
    public int hashCode()
    {
        int hash = 0;
        hash += (reservationID != null ? reservationID.hashCode() : 0);
        hash += (int) tableID;
        return hash;
    }

    @Override
    public boolean equals(Object object)
    {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof ReservationDetailsPK))
        {
            return false;
        }
        ReservationDetailsPK other = (ReservationDetailsPK) object;
        if ((this.reservationID == null && other.reservationID != null) || (this.reservationID != null && !this.reservationID.equals(other.reservationID)))
        {
            return false;
        }
        if (this.tableID != other.tableID)
        {
            return false;
        }
        return true;
    }

    @Override
    public String toString()
    {
        return "EL.ReservationDetailsPK[reservationID=" + reservationID + ", tableID=" + tableID + "]";
    }

}
